<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML>
<html>
<head>
<title>My JSP 'editDisease.jsp' starting page</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-collapse.js"></script>
<script type="text/javascript" src="js/bootstrap-tab.js"></script>
<script type="text/javascript" src="js/bootstrap-popover.js"></script>
<link href="assets/ico/biologo.ico" rel="shortcut icon">
<style type="text/css">
body {
	font-family: 方正静蕾简体;
}

input {
	font-family: 方正静蕾简体;
}

.add-on {
	font-family: serif;
}

.content {
	margin-left: 20%;
	position: absolute;
	top: 0px;
	width: 700px;
	margin-left: 360px;
	top: 0px;
}

.leftDiv {
	padding-left: 10px;
	margin-left: 0px;
	margin-top: 12px;
	font-family: 方正静蕾简体;
	background-color: #FDFDFD;
	background-image: url("image/frenchstucco.png");
	border-radius: 0px 160px 6px 0px;
	width: 260px;
	height: auto;
}

.diseaseCategorySn {
	cursor: pointer;
}

img {
	margin-top: 10px;
}
</style>
</head>
<body>
	<%@ include file="include/topbar.jsp"%>

	<div class="leftDiv">
		<h2 style="padding-top:60px;">病例的分类</h2>
		<br> <span><a id="allfolds" href="javascript:void(0)"
			onclick="allFold()">－</a> 全部折叠</span> <br />
		<c:forEach var="diseaseCategory" items="${diseaseCategoryList }">

			<span class="diseaseCategorySn" id="stackFirst${diseaseCategory.sn}">
				＋<input type="hidden" name="diseaseCategorySnHidden"
				value="${diseaseCategory.sn }" /> </span>${diseaseCategory.name}
		<br />

			<div class="typeanddisease" id="stackTwo${diseaseCategory.sn}"
				style="display: none">

				<c:forEach var="diseaseType" items="${diseaseCategory.diseaseTypes}">
&nbsp;&nbsp;
				<%--第二层的东西------------------------- --%>
					<span style="cursor: pointer;" class="diseaseTypeSn"
						id="stackSecound${diseaseType.sn}"> ＋<input type="hidden"
						name="diseaseTypeSnHidden" value="${diseaseType.sn}" /> </span>${diseaseType.name}
				<br />
					<div class="diseaseType" id="stackThree${diseaseType.sn}"
						style="display:none">
						<c:forEach var="disease" items="${diseaseType.diseases}">
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="searchResultPage.action?sn=${disease.sn }">${disease.name}</a>
							<br />
						</c:forEach>
						<br />
					</div>
				</c:forEach>
				<hr />
			</div>
		</c:forEach>
	</div>
	<div class="content">
		<hr />
		<img alt="" src="img/baolude-logo.gif">
		<hr />
		<i class="icon-home"></i>
		<a href="togetHomePageOfDisease.action">查询主页</a>》》》 <i
			class="icon-list-alt"></i> <a
			href="searchResultPage.action?sn=${disease.sn}">${disease.name}</a>》》》<i class="icon-edit"></i>编辑:${disease.name}

		<hr />
		<form class="editDisea" action="updatedisease.action" method="post">

			<div class="input-prepend">
				<input type="hidden" name="disease.sn" value="${disease.sn}" />
				 
				<span class="add-on">疾病名称：</span>
				<input style="font-family: 方正静蕾简体;" id="prependedInput" class="span3" type="text" name="disease.name" value="${disease.name}" size="22">
				<br /> 
				<span class="add-on">别名：</span>
				<input style="font-family: 方正静蕾简体;" id="prependedInput" class="span3" type="text" size="22"
					name="disease.alias" value="${disease.alias}" />
				<br /> 
				<span class="add-on">编号：</span><input style="font-family: 方正静蕾简体;"
					id="prependedInput" class="span3" type="text" size="16" type="text" name="disease.code" value="${disease.code}" />
				<br /> 
				<span class="add-on">缩写：</span><input style="font-family: 方正静蕾简体;" id="prependedInput" class="span3" type="text" size="16" type="text"
					name="disease.abbreviation" value="${disease.abbreviation}" />
				<br />
				<span class="add-on">疾病父源：</span><input style="font-family: 方正静蕾简体;"
					id="prependedInput" class="span3" type="text" size="16" type="text"
					name="disease.parent" value="${disease.parent}" onblur="verifyRegForParent()"/><span class="diseaseParentTishi"></span>
				<br /> 
				<span class="add-on">平均值(1)：</span><input style="font-family: 方正静蕾简体;"
					id="prependedInput" class="span3" type="text" size="16" type="text"
					name="disease.avg1" value="${disease.avg1}" />
				<br /> 
				<span class="add-on">所属类型：</span><input style="font-family: 方正静蕾简体;"
					id="prependedInput" class="span3" type="text" size="16" type="text"
					name="diseaseType.name" value="${disease.diseaseType.name}" />
				<br />
				<input type="hidden" name="diseaseType.sn"
					value="${disease.diseaseType.sn}" /> <input type="hidden"
					name="diseaseCategory.sn"
					value="${disease.diseaseType.diseaseCategory.sn}" /> <input
					type="hidden" name="diseaseCategory.name"
					value="${disease.diseaseType.diseaseCategory.name}" /> 
			</div>
		</form>
					<a id="btnForSubmit" class="btn btn-success" type="submit" ><i class="icon-edit icon-white"></i>&nbsp;&nbsp;&nbsp;提交</a>
	</div>
</body>

<script type="text/javascript">
		$(function(){
			$("input[name='disease.parent']").focus(function(){
				$(".diseaseParentTishi").text("");
			});
			
			$("#btnForSubmit").click(function(){
				$("form[class='editDisea']").submit();
			});
			
		});
		function verifyRegForParent(){
			if($("input[name='disease.parent']").val().trim()==""){
				$(".diseaseParentTishi").text("请输入父源!");
				
				$(".diseaseParentTishi").css({"color":"red","font-size": "16px;"});
			}else{
					
				if((/^\d{2}$/).test($("input[name='disease.parent']").val())){
					//$("input[name='disease.parent']").popover("show");
				}else{
					$(".diseaseParentTishi").text("输入有误，请重新输入！");
					$(".diseaseParentTishi").css({"color":"red","font-size": "16px;"});
					//$("input[name='disease.parent']").popover("show");
				}
			}
		}


	$("#allfolds").click(function() {
		$(".typeanddisease").css("display", "none");
		$(".diseaseCategorySn").text("＋");
		$("#allfolds").text(" ＋ ");
	});
	$(".diseaseCategorySn").each(function() {
		var diseaseCategorySn = $(this).children().val();
		$("#stackFirst" + diseaseCategorySn).toggle(function() {
			$("#stackTwo" + diseaseCategorySn).css("display", "block");
			$("#stackFirst" + diseaseCategorySn).text("－");
		}, function() {
			$("#stackTwo" + diseaseCategorySn).css("display", "none");
			$("#stackFirst" + diseaseCategorySn).text("＋");
		});

	});

	$(".diseaseTypeSn").each(function() {
		var diseaseTypeSn = $(this).children().val();
		$("#stackSecound" + diseaseTypeSn).toggle(function() {
			$("#stackThree" + diseaseTypeSn).css("display", "block");
			$("#stackSecound" + diseaseTypeSn).text("－");
		}, function() {
			$("#stackThree" + diseaseTypeSn).css("display", "none");
			$("#stackSecound" + diseaseTypeSn).text("＋");
		});

	});
	/*
	$("input[name='disease.parent']").popover({
			title : "错误",
			content : "输入有误！",
			trigger : "manual"
		});
		$("input[name='disease.parent']").click(function() {
			$(this).popover("hide");
		});
	*/
</script>
</html>
